﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace GenerSoft.JTGL.CommonFunc
{
    /// <summary>
    /// 公共方法测试中心
    /// </summary>
    class TestMain
    {
        static void Main(string[] args)
        {
            try
            {
                CreatedStruct cs = new CreatedStruct();
                Task ts = new Task();

                ts.taskId = "e.WorkItem.WorkItemId.";
                ts.parentId = "";
                ts.name = "description";
                ts.importantLevel = 1;
                ts.urgencyLevel = 1;
                ts.handleType = 1;
                ts.taskType = "";
                ts.taskNode = "";
                ts.ownerName = "userCode";
                ts.assigneeName = "";
                ts.originatorName = "sponsor";
                ts.originateTime = 12456;
                ts.receivedTime = 12456;
                ts.taskUrl = "url";
                cs.clientType = "web";
                cs.task = ts;


                Console.WriteLine(JsonConvert.SerializeObject(cs));
                ts.taskUrl = "appurl";
                cs.clientType = "app";
                cs.task = ts;

                Console.WriteLine("\n\n");
                Console.WriteLine(JsonConvert.SerializeObject(cs));
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

    }
    #region 待办-数据结构
    /// <summary>
    /// 待办
    /// </summary>
    public struct CreatedStruct
    {
        /// <summary>
        /// 待办列表
        /// </summary>
        public Task task { get; set; }
        /// <summary>
        /// 客户端类型：移动端 web端
        /// </summary>
        public string clientType { get; set; }
    }
    /// <summary>
    /// 待办任务明细
    /// </summary>
    public struct Task
    {
        /// <summary>
        /// 任务来源系统中的任务唯一标识 NullAble
        /// </summary>
        public string taskId { get; set; }
        /// <summary>
        /// 任务来源系统中的任务父标识 NullAble
        /// </summary>
        public string parentId { get; set; }
        /// <summary>
        /// 任务名称 Not Null
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 任务的重要程度。1表示一般，2表示重要  Not Null
        /// </summary>
        public int importantLevel { get; set; }
        /// <summary>
        /// 任务的紧急程度。1表示一般，2表示急；3表示紧急 Not Null
        /// </summary>
        public int urgencyLevel { get; set; }
        /// <summary>
        /// 办理类型。1表示需要处理的任务，2表示传阅的任务 Not Null
        /// </summary>
        public int handleType { get; set; }
        /// <summary>
        /// 任务类型（一般是与业务流程名称对应）NullAble
        /// </summary>
        public string taskType { get; set; }
        /// <summary>
        /// 任务节点（一般是与业务流程环节对应）NullAble
        /// </summary>
        public string taskNode { get; set; }
        /// <summary>
        /// 任务地址（不包含域名部分，域名在业务系统向一体化任务服务中心注册时提供 NullAble
        /// </summary>
        public string taskUrl { get; set; }
        /// <summary>
        /// 任务所有者的用户名（工号）Not Null
        /// </summary>
        public string ownerName { get; set; }
        /// <summary>
        /// 任务代理人的用户名（工号）NullAble
        /// </summary>
        public string assigneeName { get; set; }
        /// <summary>
        /// 发起人的用户名（工号） Not Null
        /// </summary>
        public string originatorName { get; set; }
        /// <summary>
        /// 任务发起时间（时间戳格式），一般指的是流程的发起时间 Not Null
        /// </summary>
        public long originateTime { get; set; }
        /// <summary>
        /// 任务的接收时间（时间戳格式），一般指的是任务的创建时间 Not Null
        /// </summary>
        public long receivedTime { get; set; }
    }
    #endregion
}
